<template>
  <el-dialog :visible.sync="value" :before-close="cancel">
    <template slot="title">
      提现{{this.rowData.type === 0 ? '退回' : '成功'}}审核
    </template>
    <el-form :model="form" :rules="auditRule" ref="auditForm" :label-width="formLabelWidth">
      <el-form-item label="审核备注" prop="remark">
        <el-col :span="16">
          <el-input type="textarea" v-model="form.remark" auto-complete="off" @keyup.enter.native="doSave({action: 'saveForm', form: 'auditForm'})"></el-input>
        </el-col>
      </el-form-item>
      <el-form-item label="结果" prop="status">
        <el-col :span="16">
          <el-radio-group v-model="form.status" size="medium">
            <el-radio-button :label="1" value="1">通过</el-radio-button>
            <el-radio-button :label="2" value="2">拒绝</el-radio-button>
          </el-radio-group>
        </el-col>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button type="primary" @click="doSave({action: 'saveForm', form: 'auditForm'})">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>

  import {form} from '@/build'
  import {updateWithdrawAuditStatus} from '@/services/api/withdraw';

  export default {
    name: "audit-withdraw-return-dialog",
    props: ['value', 'id','rowData', 'menuId'],
    mixins: [form],
    data() {
      return {
        formLabelWidth: '180px',
        form: {
          orderId: this.id,
          comment:undefined,
          status: undefined,
          menuId: this.menuId,
        },
        auditType: 1,//退回和成功
        auditRule: {
          remark: [
            {required: true, message: '备注不能为空', trigger: 'blur'},
          ],
          status: [
            {required: true, message: '请确认审核结果', trigger: 'blur'},
          ],
        }
      }
    },
    mounted() {
      this.bindSave(updateWithdrawAuditStatus, 'saveForm', 'form', {
        afterSuccess: () => {
          this.cancel()
          this.$parent.getAll()
        }
      });
    },
    methods: {
      cancel() {
        this.$emit('input', false);
      },
    },

  }
</script>

<style lang="scss" scoped>

</style>
